package gui.commands.stateDiagramCommands;

import data.DataVector;
import data.classDiagram.ClassEntity;
import data.stateDiagram.State;
import gui.commands.ICommand;

/**
 * User: Szymon Kudzia
 * Date: 12.05.13
 * Time: 14:36
 */
public class DeleteStateCommand implements ICommand {
	protected State state;
	protected ClassEntity entity;

	public DeleteStateCommand(ClassEntity entity, State state) {
		this.entity = entity;
		this.state = state;
	}

	@Override
	public void execute() {
		entity.getStateDiagram().getStates().remove(state);

		DataVector.getInstance().refresh();
	}

	@Override
	public void undo() {
		entity.getStateDiagram().addState(state);

		DataVector.getInstance().refresh();
	}

	@Override
	public void redo() {
		entity.getStateDiagram().getStates().remove(state);

		DataVector.getInstance().refresh();
	}
}
